package com.lb.shopguide.manager.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.lb.shopguide.config.UserConfigManager;
import com.lb.shopguide.constants.AppConstant;
import com.lb.shopguide.ui.activity.BossMainActivity;
import com.lb.shopguide.ui.activity.GuideMainActivity;

public class MyReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(AppConstant.BROADCAST_LOGIN)) {
            int terminalType = UserConfigManager.getInstance(context).getTerminalType();
            if (terminalType == AppConstant.TERMINAL_TYPE_GUIDE) {
                ActivityUtils.startActivity(context.getPackageName(), GuideMainActivity.class.getName());
            } else if (terminalType == AppConstant.TERMINAL_TYPE_BOSS) {
                ActivityUtils.startActivity(context.getPackageName(), BossMainActivity.class.getName());
            } else if (terminalType == -1) {//之前的导购端，不存在这个字段，直接进入导购端
                ActivityUtils.startActivity(context.getPackageName(), GuideMainActivity.class.getName());
            }
        }
    }

}
